package bold.module.thrift.client;

import bold.module.thrift.genapi.User;
import bold.module.thrift.genapi.UserI;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

import java.util.Arrays;

public class Client3 {
    public static void main(String[] args) throws TException {
        TTransport transport = new TFramedTransport(new TSocket("localhost", 8888));
        UserI.Client client = new UserI.Client(new TBinaryProtocol(transport));
        transport.open();
        User user = new User((short) 18, true, "刘德华", Arrays.asList("课程1", "课程2", "课程3"));

        System.out.println(client.getName(user));
        transport.close();
    }
}
